<?php
 /******************************************************************************
 *   GunCMS is an avid supporter of open source software. This is the appropriate 
 *   option if you are creating an open source application with a license 
 *   compatible with the GNU GPL license v3.
 *   For details http://www.gnu.org/licenses/gpl.html
 *   DO NOT USE FOR COMMERCIAL WITHOUT PERMISSION
 *
 * GunCMS Version 1.0.3
 * Copyright(c) 2009-2010, T & L GdbR
 * info@guncms.de
 * 
 * http://www.guncms.de
 ********************************************************************************/
class BgcmsOverview extends BgcmsProcess {
	var $db;
 	var $smarty;	
	public function __construct($db, $smarty) {
		$this->db = $db;
		$this->smarty = $smarty;
	}
		
	public function __destruct() {
		//
	}
	
  	public function process(){

		$alluser = BgcmsOverviewBean::count_all_user($this->db);
        $this->smarty->assign("ALLUSERS", $alluser->alluser);
		
		$allcat = BgcmsOverviewBean::count_all_cat($this->db);
        $this->smarty->assign("ALLCATS", $allcat->allcat);
		
		$allpage = BgcmsOverviewBean::count_all_page($this->db);
        $this->smarty->assign("ALLPAGES", $allpage->allpage);
		
        /*$page = BgcmsOverviewBean::get_latest_page($this->db, 1);
        $this->smarty->assign("PAGES", $page);
                
        $user = BgcmsOverviewBean::get_latest_user($this->db, 1);
        $this->smarty->assign("USERS", $user);
        
        $customer = BgcmsOverviewBean::get_latest_customer($this->db, 1);
        $this->smarty->assign("CUSTOMERS", $customer);
        
        $project = BgcmsOverviewBean::get_latest_project($this->db, 1);
        $this->smarty->assign("PROJECTS", $project);*/
        
        $nPage = $this->db->get_var("SELECT count(page_id) FROM " . TBL_PAGE);
        $nUser = $this->db->get_var("SELECT count(user_id) FROM " . TBL_USER);
        $nCat = $this->db->get_var("SELECT count(cat_id) FROM " . TBL_CATEGORY);
        
        $Stats = sprintf(_("There are currently %s page(s) contained within %s category(s) and %s user(s)"),
					"<b style='color:blue'>" . $nPage . "</b>",
					"<b style='color:blue'>" . $nCat . "</b>",
					"<b style='color:blue'>" . $nUser . "</b>");
        $this->smarty->assign("STATS", $Stats);
        $this->Run();
	 }
}
?>